<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="generator" content="PSPad editor, www.pspad.com">
  <title></title>
  <script type="text/javascript">
  function load() {
    var source = document.getElementById('source');
    var src = source.innerHTML;
    
    var reComment = /(\/\/.*)\n/g;
    var reMultiComment = /(\/\*([^\*]|\*(?!\/))*\*\/)/g;
    
    var reReserved = /(\W)(null|true|false|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|this|throw|try|typeof|var|void|while|with)([^\w\d])/g;

    var reRegExp = /([^\d\w'"])(\/(?:\\\/|[^\/\s])+\/)([^\d\w'"])/g;
    var reString = /(['"])([^'"]+\1)/g;
         
    
    //src = src.replace(reComment, '<span class="COMM">$1</span>\n');
    //src = src.replace(reMultiComment, '<span class="COMM">$1</span>');
    src = src.replace(reRegExp, '$1<span class="REGX">$2</span>$3');
    //src = src.replace(reString, '<span class="STRN">$1$2</span>');
    
    //src = src.replace(reReserved, '$1<b>$2</b>$3');
    src = src.replace(reReserved, '$1<span class="KEYW">$2</span>$3');
    
    source.innerHTML = src;
    
    var lineno = document.getElementById('lineno');
    
    var match = src.match(/\n/g);
    var num = match ? match.length : 0;
    var s = [], sl = 0;
    
    for(var i=1; i<=num; i++){
      //s[sl++] = '<div line="'+i+'">' +  i + '</div>';
      s[sl++] = '<a name="l'+i+'"/><div line="'+i+'">' +  i + '</div>';
    }
    
    lineno.innerHTML = s.join('');
  }
  function onClick(o) {
    alert(event.srcElement.line)
  }
  </script>
  <style>
  body, pre {
    margin: 0;
    padding: 0;
  }
  
  #lineno {
    float: left;
    text-align: right;
    padding: 0 5px;
    background: #eee;
  }
  
  span.KEYW { color: #6277AA; font-weight: bold; }
  span.COMM { color: #008200; }
  span.NUMB { color: #393;}
  span.STRN { color: #00d; }
  span.REGX { color: #339;}
  
  </style>
  </head>
  <body onload="load();">
  <div>
    <pre id="lineno" onclick="onClick()">
    </pre>
    <pre id="source">
jDev = {

  // single
  settings: {
    loadFirebug: false,
    
    windowHeight: 250,
    windowVisible: true
  },
  
  /* multi
  line
  */
  _modules: [
    'model/core/event',
    'model/core/ajax',
    'model/engine/ui'
    //'model/engine/console',
    //'controller/doc',
    //'controller/test'
  ],
  
  _timer: null,
  
  emptyFn: function(){},

  baseURL: null,
  sourceURL: null,
  importURL: null,

  isFirefox:  navigator.userAgent.indexOf('Firefox') != -1,
  isIE:       navigator.userAgent.indexOf('MSIE') != -1,
  isOpera:    navigator.userAgent.indexOf('Opera') != -1,
  isSafari:   navigator.userAgent.indexOf('AppleWebKit') != -1,
  
  init: function() {
    jDev.findLocation();
    
    if (!jDev.isFirefox && jDev.settings.loadFirebug) {
      jDev.loadScript(jDev.importURL + 'firebugLite/firebug-lite-web.js');
      jDev._timer = setInterval(jDev._waitFirebugLoad, 200);
    }

    for(var i=0, m=jDev._modules, mi; mi=m[i]; i++) {
      jDev.loadScript(jDev.sourceURL + 'jDev/' + mi + '.js');
    }
    
  },
  
  findLocation: function() {
    var rePath = /^(.*\/)[^\/]+\.\w+.*$/;
    var reProtocol = /^\w+:\/\//;
    var head = document.documentElement.firstChild;
    var path = null;
    
    for(var i=0, c=head.childNodes, ci; ci=c[i]; i++) {
      if ( ci.nodeName == 'SCRIPT' && 
          (ci.src.indexOf('jproton.js') != -1 || ci.attributes.jproton) ) {
        
        if (reProtocol.test(ci.src)) {
          // absolute path
          path = rePath.exec(ci.src)[1];
          
        } else {
          // relative path
          var r = rePath.exec(ci.src);
          var src = r ? r[1] : ci.src;
          var rel = /^((\.\.\/)+)(.*)/.exec(src);
          var lastFolder = /^(.*\/)\w+\/$/;
          path = rePath.exec(location.href)[1];
          
          if (rel) {
            var j = rel[1].length/3;
            var p;
            while (j-- > 0) {
              path = lastFolder.exec(path)[1];
            }
            path += rel[3];
          }
        }
        
        break;
      }
    }
    
    if (path && /source\/$/.test(path)) {
      jDev.sourceURL = path;
      jDev.baseURL = path.substr(0, path.length-7);
      jDev.importURL = jDev.baseURL + 'import/';
      jDev.devURL = jDev.sourceURL + 'jDev/';
      jDev.viewURL = jDev.sourceURL + 'jDev/view/default/';
    } else {
      throw 'Não foi possível encontrar o caminho automaticamente!';
    }
  },
  
  /*
   * Carrega o script dinamicamente.
   */
  loadScript: function(url) {
    var agent = navigator.userAgent;

    if (jDev.isIE || jDev.isSafari) {
      document.write('<scr'+'ipt src="' + url + '"><\/scr'+'ipt>');
       
    } else {
      var script = document.createElement('script');
      script.src = url;
      document.documentElement.firstChild.appendChild(script);
    }
  },
  
  loadCSS: function(url){
    var link = document.createElement('link');
    link.href = url;
    link.rel = 'stylesheet';
    link.type = 'text/css';
    document.documentElement.firstChild.appendChild(link);
  },
  
  getCSS: function(e, name) {
    return window.getComputedStyle ? // Tenta o modo Mozilla
        document.defaultView.getComputedStyle(e,null)[name] || 
        e.style[name] :          // Ou então, tenta a propriedade style
        e.currentStyle ?         // Tenta o modo IE
        e.currentStyle[name] ||  // Se não der certo,
        e.style[name] :          // tenta a propriedade style. Senão,
        undefined;               // Não foi possível recuperar o estilo
  },
  
  
  module: function(ns, source) {
    if (ns) {
      var n = ns.split('.');
      var target = window, o;
      
      for (var i = 0, l = n.length-1, ni; (ni = n[i]) && (i < l); i++) {
        target = (o = target[ni]) ? o : target[ni] = {};
      }
      
      target = target[ni] = source || {};
      target.extend = jDev.extend;
    
      return target;
    } else {
      return false;
    }
  },
  
  extend: function() {
    var target = this, t = target, source, p, o,
        a0 = arguments[0], ai = 0, al = arguments.length;

    // processa o target
    if (al > 1) {
      ai++;
      target = t = a0;
    }

    // processa a extensão para cada objeto fonte
    for(; source = arguments[ai]; ai++)

      // para cada propriedade do objeto fonte
      for(var prop in source) {
        p = source[prop];
        
        // herda as propriedades do objeto fonte
        if (prop.charAt(0) != '@') {
          
          // se a propriedade for um array, extende esse array. Ou seja, se
          // já existir algum array na propriedade do objeto destino, concatena 
          // com o outro array. Se não existir, copia o array.
          if (p && p.splice) {
            var tp = t[prop];
            t[prop] = tp && tp.splice ? tp.concat(p) : new Array().concat(p);

          // se a propriedade for um objeto, extende esse objeto. Ou seja, se
          // já existir algum objeto na propriedade do objeto destino, extende o
          // objeto. Se não existir, cria uma cópia do objeto.
          } else if (p && typeof p == 'object') {
            t[prop] = jDev.extend(t[prop] || {}, p);

          // se for uma propriedade comum, copia seu valor
          } else {
            t[prop] = p;
          }
          
        } else {
          // processa a dependência de módulos
          if (prop == '@init') {
            p.call(t);
            
          // processa a dependência de módulos
          } else if (prop == '@require') {
            for (var ext in p) {

              // versão requerida
              var v = p[ext];
              
              // verifica se extensão requerida está instalada
              o = t.extensions[ext] || null;

              // confirma a existência e versão da extensão
              if (!o)
                throw 'A extensão "'+ext+'" deve estar instalada.';

              else if (o < v && v != 'all')
                throw 'A extensão "'+ext+'" deve ter a versão '+v+' ou superior.';
            }

          // processa o registro da extensão
          } else if (prop == '@extension') {

            // registra a extensão no namespace "extensions" do objeto
            o = t.extensions || (t.extensions = {});
            for (var name in p) {
              o[name] = p[name];
            }
          }
        }
      }
    // retorna o objeto alvo extendido
    return target;
  },  
  
  /*
   * From Jesse Skinner:
   * http://www.thefutureoftheweb.com/blog/adddomloadevent
   * 
   * (c)2006 Jesse Skinner/Dean Edwards/Matthias Miller/John Resig
   * Special thanks to Dan Webb's domready.js Prototype extension
   * and Simon Willison's addLoadEvent
   */
  onReady: (function(){
    // create event function stack
    var load_events = [],
      load_timer,
      script,
      done,
      exec,
      old_onload,
      init = function () {
        done = true;
  
        // kill the timer
        clearInterval(load_timer);
  
        // execute each function in the stack in the order they were added
        while (exec = load_events.shift())
          exec();
  
        if (script) script.onreadystatechange = '';
      };
  
    return function (func, doc) {
      // if the init function was already ran, just run this function now and stop
      if (done) return func();
      
      doc = doc || document;
  
      if (!load_events[0]) {
        // for Mozilla/Opera9
        if (doc.addEventListener)
          doc.addEventListener('DOMContentLoaded', init, false);
  
        // for Internet Explorer
        /*@cc_on @*/
        /*@if (@_win32)
          doc.write('&lt;script id=__ie_onload defer src=//0&gt;&lt;\/scr'+'ipt&gt;');
          script = doc.getElementById('__ie_onload');
          script.onreadystatechange = function() {
            if (this.readyState == 'complete')
              init(); // call the onload handler
          };
        /*@end @*/
  
        // for Safari
        if (/WebKit/i.test(navigator.userAgent)) { // sniff
          load_timer = setInterval(function() {
            if (/loaded|complete/.test(doc.readyState))
              init(); // call the onload handler
          }, 10);
        }
  
        // for other browsers set the window.onload, but also execute the old window.onload
        old_onload = window.onload;
        window.onload = function() {
          init();
          if (old_onload) old_onload();
        };
      }
  
      load_events.push(func);
    };
  })(),

  _waitFirebugLoad: function() {
    if( typeof firebug != 'undefined' && firebug.el && 
        firebug.el.main && firebug.el.main.element ) {
      
      clearInterval(jDev._timer);
      
      jDev._firebugElement = firebug.el.main.element;
      
      $$event.add(
          document.getElementById('FirebugCloseButton'), 
          'click', 
          $$win.toggleFirebug
        );
      
      // oculta o firebug durante seu carregamento
      firebug.win.minimize();
      jDev._firebugElement.style.top = '-2024px';
      setTimeout(jDev._hideFirebug, 50);
      
      $$console.info('O Firebug Lite foi carregado... pressione F12 para abrir a janela.')
    }
  },
  
  _hideFirebug: function(){
    jDev._firebugElement.style.display = 'none';
    jDev._firebugElement.style.top = '';
  }  

};

$$extend = jDev.extend;
$$module = jDev.module;

window.onerror = function(){}

function printStackTrace() {
    var callstack = [];
    var isCallstackPopulated = false;
    try {
        i.dont.exist+=0; //does not exist - that's the point
    } catch(e) {
        if (e.stack) { //Firefox
            var lines = e.stack.split("\n");
            for (var i = 0, len = lines.length; i < len; i++) {
                if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) {
                    callstack.push(lines[i]);
                }
            }
            //Remove call to printStackTrace()
            callstack.shift();
            isCallstackPopulated = true;
        }
        else if (window.opera && e.message) { //Opera
            var lines = e.message.split("\n");
            for (var i = 0, len = lines.length; i < len; i++) {
                if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) {
                    var entry = lines[i];
                    //Append next line also since it has the file info
                    if (lines[i+1]) {
                        entry += " at " + lines[i+1];
                        i++;
                    }
                    callstack.push(entry);
                }
            }
            //Remove call to printStackTrace()
            callstack.shift();
            isCallstackPopulated = true;
        }
    }
    if (!isCallstackPopulated) { //IE and Safari
        var currentFunction = arguments.callee.caller;
        while (currentFunction) {
            var fn = currentFunction.toString();
            //If we can't get the function name set to "anonymous"
            var fname = fn.substring(fn.indexOf("function") + 8, fn.indexOf("(")) || "anonymous";
            callstack.push(fname);
            currentFunction = currentFunction.caller;
        }
    }
    return callstack.join("\n");
}
    </pre>
  </div>
  

  </body>
</html>
